package com.craftplay.dao;

import com.craftplay.model.BannerImage;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BannerImageMapper {
    @Insert({
        "insert into banner_image (id, title, ",
        "scope, jump_url, ",
        "url)",
        "values (#{id,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, ",
        "#{scope,jdbcType=VARCHAR}, #{jumpUrl,jdbcType=VARCHAR}, ",
        "#{url,jdbcType=VARCHAR})"
    })
    int insert(BannerImage record);

    @Select({
            "select",
            "id, title, scope, url, jump_url",
            "from banner_image"
    })
    List<BannerImage> listAll();

    @InsertProvider(type=BannerImageSqlProvider.class, method="insertSelective")
    int insertSelective(BannerImage record);
}